﻿@if (false) 
{ 
    // Just use this script to enable jQuery intellisense in Visual Studio. Never render to real HTML.
    <script src="/Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"></script>
}
@using ORM.Web.Models
@using ORM.Models
@model ORM.Areas.Admin.ViewModels.ManageCategories.ListDeviceViewModel
@{
    ViewBag.Title = "Manage Device Categories";
    ViewBag.MenuGroup = "Categories";
    ViewBag.MenuName = "ManageDeviceCategories";
    ViewBag.PageHeader = "Manage Device Categories";
}
@(Html.Telerik().Grid(Model.Devices)
           .Name("DeviceCategories")
           .DataKeys(dataKeys => dataKeys.Add(c => c.Id))
           .ToolBar(commands => commands.Template(
                @<text>
                    @Html.Partial("_AddButton", new ActionInfo("Create a new record", "CreateDeviceCategory"))
                </text>
           ))
           .Columns(columns =>
           {
               columns.Bound(o => o.Name).Width("250px");
               //columns.Bound(o => o.Description).Width("350px").Sortable(false);
               columns.Template(
                   @<text> 
                        @Html.Partial("_EditButton", new ActionInfo("Edit", "EditDeviceCategory") { Id = item.Id })
                        @Html.Partial("_DeleteButton", new ActionInfo("Delete", "DeleteDeviceCategory") { Id = item.Id })
                   </text>
                );
           })
           .Pageable(pager => pager.PageSize(AppConfigs.DefaultAdminGridPageSize))
           .Sortable()
           .Scrollable(scrolling => scrolling.Enabled(true).Height(350))
)
<script type="text/javascript">
    $(document).ready(function () {
        $(".t-grid-delete").click(function (e) {
            if (!confirm("Are you sure you want to delete this device?")) {
                return false;
            }
        });
    });
</script>
